package com.powernode.utils;

import com.powernode.model.LoginUserDetails;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @description:
 * @author: mky
 * @date: 2024/7/9 15:10
 * @version: 1.0
 */
public class AuthUtils {
    public static LoginUserDetails getLoginedUserDetails(){
        return  (LoginUserDetails) SecurityContextHolder
                .getContext().getAuthentication().getPrincipal();
    }
    public static Long getLoginedUserId(){
        return getLoginedUserDetails().getUserId();
    }


}
